<%@taglib uri="/struts-tags" prefix="s"%>
<script type="text/javascript" charset="utf-8"
	src="js/jquery.listnav.min-2.1.js"></script>
<script type="text/javascript" charset="utf-8"
	src="js/jquery.dataTables.listnav.js"></script>
<script type="text/javascript" charset="utf-8">
	$(document)
			.ready(
					function() {
						$("input[name=expressionOfInterest]")
								.click(
										function() {
											if ($(
													"input[name=expressionOfInterest]")
													.prop("checked")) {
												$("ul#organisation-tab")
														.append(
																"<li id='detail3'><a href='#2' data-toggle='tab'>Details 3</a></li>");
											} else {
												$("li#detail3").remove();
											}
										});
						//validate postcode
						var postcodes = new Array();
						
						$.ajax({
							url: 'checkPostCodeAjax.action',
							success: function(data){
								postcodes = data.postcodes;
							}
						});
						
						$("form#create-organisation").submit(function() {
							if (jQuery.trim($("input#postcode-id").val()).length == 0) {
								alert("Postcode cannot be null!");
								return false;
							} else {
								var flag = $.inArray($("input#postcode-id").val(), postcodes);
								if (flag == -1) {
									var r = confirm('Address Details cannot be confirmed - Do you wish to enter Unconfirmed Address Data?');
									if (r == true) {
										return true;
									} else {
										$("input#postcode-id").val("");
										$("input#postcode-id").focus();
										return false;
									}
								} else {
									return true;
								}
								return false;	
							}		
						});
				});
</script>
<s:if test="#session.logged != 'true'">
	<jsp:forward page="../index.jsp" />
</s:if>
<div class="content">
	<div class="row-fluid">
		<form id="create-organisation" action="createOrganisation.action" class='validate form-horizontal' method="post">
		<div class="span12">
			<div class="box">
				<div class="box-head tabs">
					<div style="width: 273px;">
						<h3>Organisation Details</h3>
						<ul id="organisation-tab" class="nav nav-tabs"
							style="float: left; margin-top: 10px;">
							<li class='active'><a href="#0" data-toggle="tab">Details1</a></li>
							<li><a href="#1" data-toggle="tab">Details 2</a></li>										
 						</ul>											
					</div>
					<div style="float: right;">
						<ul style="list-style: none; margin: 10px 0 0 0;">							
							<li style="float: left; margin-right: 10px;"><button id="save-organisation" class="btn btn-success" type="submit">Save</button></li>
							<li style="float: left; margin-right: 10px;"><a id=""
								href="listOrganisation.action" class="btn btn-success">Back</a></li>
						</ul>
					</div>
				</div>
				<div class="box-content" id="organisation">
					<div class="tab-content">
						<div class="tab-pane active" id="0">							
							<div class="row-fluid force-margin">
								<div class="span3">
									<div class="control-group">
										<label for="req" class="control-label require">Organisation
											Name</label>
										<div class="controls">
											<input type="text" name="organisationName" id="req"
												class='required'>												
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label require">Organisation
											Short Description</label>
										<div class="controls">
											<textarea style="resize: none; width: 219px;"
												name="organisationShortDescription" id="basictext"
												class='span9 input-square' rows="6"></textarea>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Lead Contact</label>
										<div class="controls">
											<input type="hidden" name="leadContactId" id="contact-id" class='input-medium input-square' readonly="readonly" value=""> 
											<input type="text" name="leadContactName" id="contact-name" class='input-medium input-square' readonly="readonly" value=""> 
											<a id="lookup-contact" data-toggle="modal" href="#lookUpContact">Lookup</a>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label require">Address Line 1</label>
										<div class="controls">
											<input type="text" name="addressLine1" id="req">
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Address Line 2</label>
										<div class="controls">
											<input type="text" name="addressLine2" id="req">
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Address Line 3</label>
										<div class="controls">
											<input type="text" name="addressLine3" id="req">
										</div>
									</div>
									<div class="control-group">
										<label for="email3" class="control-label require">Postcode</label>
										<div class="controls">											
											<input type="text" name="postcode" id="postcode-id" class='input-medium input-square' value=""> 
											<a class="" id="lookup-postcode" data-toggle="modal" href="#lookUpPostcode">Lookup</a>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">City/Town</label>
										<div class="controls">
											<input type="text" name="city" id="city">
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">County</label>
										<div class="controls">
											<input type="text" name="county" id="req">
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Nation/Country</label>
										<div class="controls">
											<s:select list="countries" name="country"
												listKey="countryId" listValue="countryName" id="selsear"
												headerKey="-1" required="true" headerValue="">
											</s:select>
										</div>
									</div>
								</div>
								<div class="span3">
									<div class="control-group">
										<label for="medium" class="control-label">Preferred
											Organisation</label>
										<div class="controls">											
											<s:checkbox name="preferredOrganisation" id="check" />
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Expression of
											Interest</label>
										<div class="controls">											
											<s:checkbox name="expressionOfInterest" />
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label require">Type of
											Business</label>
										<div class="controls">
											<input type="hidden" name="businessId" id="businessIdHidden"
												class='input-medium input-square' readonly="readonly"
												value=""> <input type="text" name="businessName"
												id="txtBussinessName" class='input-medium input-square'
												readonly="readonly" value="">
												<a id="look-up" data-toggle="modal" href="#lookUpBusiness">Lookup</a>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">SIC Code</label>
										<div class="controls">
											<input style="width: 50px;" type="text" name="sICCode"
												id="txtSICCode" class='input-medium input-square'
												readonly="readonly" value="">
										</div>
									</div>
									<div class="control-group">
										<label for="check" class="control-label">Organisation
											Full Description</label>
										<div class="controls">
											<textarea style="resize: none; width: 219px;"
												name="organisationFullDescription" id="basictext"
												class='span9 input-square' rows="6"></textarea>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label require">Phone Number</label>
										<div class="controls">
											<input type="text" name="phoneNumber" id="req"
												class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Fax</label>
										<div class="controls">
											<input type="text" name="fax" id="req" class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Email</label>
										<div class="controls">
											<input type="text" name="email" id="req" class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Web Address</label>
										<div class="controls">
											<input type="text" name="webAddress" id="req"
												class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Charity Number</label>
										<div class="controls">
											<input type="text" name="charityNumber" id="req"
												class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Company Number</label>
										<div class="controls">
											<input type="text" name="companyNumber" id="req"
												class='required'>
										</div>
									</div>
								</div>
							</div>							
						</div>										
						 <div class="tab-pane" id="1">
							<div class="row-fluid force-margin">
								<div class="span3">
									<div class="control-group">									
										<label for="req" class="control-label">Organisation
											Specialism</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="organisationSpecialisms" name="organisationSpecialism" listKey="id" listValue="name"></s:checkboxlist>
														<%-- <s:iterator value="organisationSpecialisms"
															var="organisationSpecialism">
															<label class="checkbox"><input type="checkbox"
																class='uniform' name="OS<s:property value="id" />" id="check2"
																value="<s:property value="id" />"> <s:property
																	value="name" /></label>
														</s:iterator> --%>
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Service
											Disabilities Capabilities</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="disabilitiesCapabilities" name="disabilitiesCapability" listKey="id" listValue="name"></s:checkboxlist>														
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Service
											Barriers Capabilities</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="barriersCapabilities" name="barriersCapability" listKey="id" listValue="name"></s:checkboxlist>														
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Service
											Benefits Capabilities</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="benefitsCapabilities" name="benefitsCapability" listKey="id" listValue="name"></s:checkboxlist>														
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<div class="span3">
									<div class="control-group">
										<label for="req" class="control-label">Service
											Personal Circumstances Capabilities</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="servicePersonalCircumstancesCapabilities" name="servicePersonalCircumstancesCapability" listKey="id" listValue="name"></s:checkboxlist>														
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Service
											Ethnicity Capabilities</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="ethnicityCapabilities" name="ethnicityCapability" listKey="id" listValue="name"></s:checkboxlist>														
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Accreditation</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="accreditations" name="accreditation" listKey="id" listValue="name"></s:checkboxlist>														
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div> 
						 <div class="tab-pane" id="2">
							<div class="row-fluid force-margin">
								<div class="span3">
									<div class="control-group">
										<label for="req" class="control-label">EOI Programmes</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="programmes" name="programme" listKey="id" listValue="name"></s:checkboxlist>														
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<div class="span3">
									<div class="control-group">
										<label for="req" class="control-label">EOI Services</label>
										<div class="controls">
											<div class="div-menu">
												<div class="control-group" style="margin-left: 10px;">
													<div class="controls">
														<s:checkboxlist theme="vertical-checkbox" list="services" name="service" listKey="id" listValue="name"></s:checkboxlist>														
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div> 
					</div>
				</div>
			</div>
		</div>
		</form>
	</div>
</div>
<!-- Lookup -->
<!-- BusinessType -->
<div id="pageLookupBusinessType"> 
	<%@ include file="LookupBusinessType.jsp" %>
</div>

<!-- Contact -->

<div id="pageLookUpContact"> 
	<%@ include file="lookUpContact.jsp" %>
</div>

<!-- Postcode -->
<div id="pageLookupPostcode">
	<%@ include file="lookUpPostcode.jsp" %>
</div>